package com.bjsxt.service.impl;

import com.bjsxt.mapper.CompanyMapper;
import com.bjsxt.pojo.Company;
import com.bjsxt.pojo.PageA;
import com.bjsxt.service.CompanyService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CompanyServiceImpl implements CompanyService {

    @Autowired
    private CompanyMapper companyMapper;

    @Override
    public PageA<Company> findMore(Integer page, Integer rows, Company company) {

        Page pg = PageHelper.startPage(page, rows);

        List<Company> list = companyMapper.selectMore(company);

        PageA<Company>  pga=new PageA<>(list,pg.getTotal());

        return pga;
    }

    @Override
    public Integer save(Company company) {
        return companyMapper.insert(company);
    }

    @Override
    public Integer change(Company company) {
        return companyMapper.update(company);
    }
}
